﻿@using Kovan.Library.Utils;
@using Kovan.Model.ViewModel.UserCenter;
@using Kovan.Library.Extensions;
@using Kovan.Model.Entity.Config;
@using Kovan.Model.Parameter.Config;
@{
    ViewBag.Title = "广告管理";
    var Items = Model as List<tb_ad>;
    var param = ViewBag.Param as PAd;
}
<form id="pagerForm" method="post" action="@Url.Content("~/Manage/Ad")">
<input type="hidden" name="PageIndex" value="@param.PageIndex" />
<input type="hidden" name="PageSize" value="@param.PageSize" />
<input type="hidden" name="adName" value="@param.adName" />
<input type="hidden" name="fileName" value="@param.fileName" />
<input type="hidden" name="isEnable" value="@param.isEnable" />
</form>
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this);" action="@Url.Content("~/Manage/Ad")" method="post">
    <div class="searchBar">
        <input type="hidden" name="PageSize" value="@param.PageSize" />
        <table class="searchContent">
            <tr>
                <td>
                    广告名称：<input type="text" name="adName" value="@param.adName" />
                </td>
                <td>
                    文件名称：<input type="text" name="fileName" value="@param.fileName" />
                </td>
                <td>
                    是否可用：
                    <select name="isEnable">
                        <option value="">请选择</option>
                        <option value="1" @(param.isEnable.HasValue && param.isEnable==1?"selected":"")>是</option>
                        <option value="0" @(param.isEnable.HasValue && param.isEnable==0?"selected":"")>否</option>
                    </select>
                </td>
            </tr>
        </table>
        <div class="subBar">
            <ul>
                <li>
                    <div class="buttonActive">
                        <div class="buttonContent">
                            <button type="submit">
                                检索</button></div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    </form>
</div>
<div class="pageContent">
    <div class="panelBar">
        <ul class="toolBar">
            <li><a class="add" href="@Url.Content("~/Manage/Ad/GetOperate")" target="dialog" rel="ad_operate" mask="true" width="800" height="350" title="添加广告">
                <span>添加</span></a></li>
            <li class="line">line</li>
            <li><a class="delete" href="javascript:;" onclick="AdManage.Delete();"><span>删除</span></a></li>
            <li class="line">line</li>
        </ul>
    </div>
    <table class="table" width="100%" layouth="138">
        <thead>
            <tr>
                <th width="3%" align="center">
                    <input type="checkbox" group="aids" class="checkboxCtrl" />
                </th>
                <th width="5%" align="center">
                    序号
                </th>
                <th>
                    广告名称
                </th>
                <th width="20%" align="center">
                    文件名称
                </th>
                <th width="10%" align="center">
                    状态
                </th>
                <th width="15%" align="center">
                    创建日期
                </th>
                <th width="10%" align="center">
                    操作
                </th>
            </tr>
        </thead>
        <tbody>
            @if (Items != null && Items.Count > 0)
            {
                for (int i = 0; i < Items.Count; i++)
                {
                    var item = Items[i];
                <tr>
                    <td>
                        <input type="checkbox" name="aids" value="@item.ad_id" />
                    </td>
                    <td>
                        @(i + 1)
                    </td>
                    <td>
                        @item.ad_name
                    </td>
                    <td>
                        @item.file_name
                    </td>
                    <td>
                        @(item.is_enable.HasValue && item.is_enable == 1 ? Html.TureHtml("是") : Html.FalseHtml("否"))
                    </td>
                    @*<td>
                        @item.application.name
                    </td>*@
                    <td>
                        @(item.create_date.HasValue ? Html.Raw(item.create_date.Value.ToString()) : Html.Raw("..."))
                    </td>
                    <td>
                        <a href="@(Url.Content("~/Manage/Ad/GetOperate?id=") + item.ad_id)" target="dialog" title="编辑广告" rel="ad_operate" mask="true" width="800" height="350">
                            编辑</a> | <a href="@(Url.Content("~/Manage/Ad/GetOperate?id=") + item.ad_id)" target="dialog" title="复制链接" rel="ad_cope" mask="true" width="800" height="350">
                            链接</a>
                    </td>
                </tr>
                }
            }
        </tbody>
    </table>
    <div class="panelBar">
        <div class="pages">
            <span>显示</span>
            <select class="combox" name="PageSize" onchange="navTabPageBreak({numPerPage:this.value})">
                <option value="10" @(param.PageSize == 10 ? "selected=selected" : "")>10</option>
                <option value="20" @(param.PageSize == 20 ? "selected=selected" : "")>20</option>
                <option value="50" @(param.PageSize == 50 ? "selected=selected" : "")>50</option>
                <option value="100" @(param.PageSize == 100 ? "selected=selected" : "")>100</option>
                <option value="200" @(param.PageSize == 200 ? "selected=selected" : "")>200</option>
            </select>
            <span>条，共 @param.TotalRows 条</span>
        </div>
        <div class="pagination" targettype="navTab" totalcount="@param.TotalRows" numPerPage="@param.PageSize" pagenumshown="10"
            currentpage="@param.PageIndex">
        </div>
    </div>
</div>
<script type="text/javascript" src="@Url.Content2("~/Scripts/Manage/Ad/Index.js")"></script>
